<template>
  <div class="forbidden">
    <img :src="name403" class="img" />
    <h1>403 - 禁止访问</h1>
    <p>抱歉，您没有权限访问该页面。</p>
    <p>将在 {{ countdown }} 秒后自动跳转到首页</p>
  </div>
</template>

<script setup>
import name403 from "@/assets/403.png";
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";

const router = useRouter();
const countdown = ref(5);

onMounted(() => {
  const timer = setInterval(() => {
    countdown.value--;
    if (countdown.value === 0) {
      clearInterval(timer);
      router.replace("/");
    }
  }, 1000);
});
</script>

<style>
.forbidden {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* height: 100vh; */
  font-family: Arial, sans-serif;
}

.forbidden h1 {
  font-size: 24px;
  /* margin-bottom: 20px; */
  color: #ff5733;
}

.forbidden p {
  font-size: 20px;
  color: #555;
}
.img {
  width: 400px;
  height: 400px;
}
</style>
